// File:    Pessoa.cs
// Author:  Lucas Bittencourt
// Created: quarta-feira, 16 de novembro de 2011 18:32:47
// Purpose: Definition of Class Pessoa

using System;
using System.Text;

namespace DA_OOMModel
{
   public class Pessoa
   {
       public Pessoa()
       {
       }
       private int pesIdPessoa;
       private string pesNmPessoa;
       private string pesNuCpfCnpj;
       private DateTime pesDtCadastro;

       private Iesi.Collections.ISet endereco;
      
      /// <summary>
      /// Property for collection of Endereco
      /// </summary>
      /// <pdGenerated>Default opposite class collection property</pdGenerated>
      public virtual Iesi.Collections.ISet Endereco
      {
         get
         {
            return endereco;
         }
         set
         {
            this.endereco = value;         
         }
      }
      private Iesi.Collections.ISet telefone;
      
      /// <summary>
      /// Property for collection of Telefone
      /// </summary>
      /// <pdGenerated>Default opposite class collection property</pdGenerated>
      public virtual Iesi.Collections.ISet Telefone
      {
         get
         {
            return telefone;
         }
         set
         {
            this.telefone = value;         
         }
      }
      private Iesi.Collections.ISet cliente;
      
      /// <summary>
      /// Property for collection of Cliente
      /// </summary>
      /// <pdGenerated>Default opposite class collection property</pdGenerated>
      public virtual Iesi.Collections.ISet Cliente
      {
         get
         {
            return cliente;
         }
         set
         {
            this.cliente = value;         
         }
      }

      private Iesi.Collections.ISet usuario;

      /// <summary>
      /// Property for collection of Usuario
      /// </summary>
      /// <pdGenerated>Default opposite class collection property</pdGenerated>
      public virtual Iesi.Collections.ISet Usuario
      {
          get
          {
              return usuario;
          }
          set
          {
              this.usuario = value;
          }
      }
      private Iesi.Collections.ISet pessoaJuridica;
      
      /// <summary>
      /// Property for collection of PessoaJuridica
      /// </summary>
      /// <pdGenerated>Default opposite class collection property</pdGenerated>
      public virtual Iesi.Collections.ISet PessoaJuridica
      {
         get
         {
            return pessoaJuridica;
         }
         set
         {
            this.pessoaJuridica = value;         
         }
      }
      private Iesi.Collections.ISet pessoaFisica;
      
      /// <summary>
      /// Property for collection of PessoaFisica
      /// </summary>
      /// <pdGenerated>Default opposite class collection property</pdGenerated>
      public virtual Iesi.Collections.ISet PessoaFisica
      {
         get
         {
            return pessoaFisica;
         }
         set
         {
            this.pessoaFisica = value;         
         }
      }
      private Iesi.Collections.ISet sacado;
      
      /// <summary>
      /// Property for collection of Sacado
      /// </summary>
      /// <pdGenerated>Default opposite class collection property</pdGenerated>
      public virtual Iesi.Collections.ISet Sacado
      {
         get
         {
            return sacado;
         }
         set
         {
            this.sacado = value;         
         }
      }
   
      /// <summary>
      /// Get value of property PesIdPessoa.
      /// </summary>
      public virtual int PesIdPessoa
      {
         get
         {
            return pesIdPessoa;
         }
         set
         {
            if (this.pesIdPessoa != value)
               this.pesIdPessoa = value;
         }
      }
      
      /// <summary>
      /// Get value of property PesNmPessoa.
      /// </summary>
      public virtual string PesNmPessoa
      {
         get
         {
            return pesNmPessoa;
         }
         set
         {
            if (this.pesNmPessoa != value)
               this.pesNmPessoa = value;
         }
      }
      
      /// <summary>
      /// Get value of property PesNuCpfCnpj.
      /// </summary>
      public virtual string PesNuCpfCnpj
      {
         get
         {
            return pesNuCpfCnpj;
         }
         set
         {
            if (this.pesNuCpfCnpj != value)
               this.pesNuCpfCnpj = value;
         }
      }
      
      /// <summary>
      /// Get value of property PesDtCadastro.
      /// </summary>
      public virtual DateTime PesDtCadastro
      {
         get
         {
            return pesDtCadastro;
         }
         set
         {
            if (this.pesDtCadastro != value)
               this.pesDtCadastro = value;
         }
      }
   
      /// <summary>
      /// Get and set primary key class
      /// </summary>
      public virtual PessoaPK PessoaPK
      {
         get 
         {
            return new PessoaPK(pesIdPessoa);
         }
         set
         {
            if (value != null)
            {
               this.pesIdPessoa = value.PesIdPessoa;
            }
         }
      }
   
      /// <summary>
      /// Get hash code
      /// </summary>
      /// <pdGenerated>Get hash code</pdGenerated>
      public override int GetHashCode()
      {
         int _hashCode = 0;
         _hashCode = 29 * PessoaPK.GetHashCode();
         if (this.pesNmPessoa != null) 
            _hashCode += 29 * pesNmPessoa.GetHashCode();
      
         if (this.pesNuCpfCnpj != null) 
            _hashCode += 29 * pesNuCpfCnpj.GetHashCode();
      
         _hashCode += 29 * pesDtCadastro.GetHashCode();
         return _hashCode;
      }
   
      /// <summary>
      /// Test if two objects are equal
      /// </summary>
      /// <param name="object">Object to compare</param>
      /// <pdGenerated>Test if two objects are equal</pdGenerated>
      public override bool Equals(object obj)
      {
         if (obj == null)
            return false;
         Pessoa cast = obj as Pessoa;
         if (!(obj is Pessoa))
            return false;
         if (!this.PessoaPK.Equals(cast.PessoaPK))
            return false;
         if (this.pesIdPessoa != cast.PesIdPessoa)
            return false;
         if (String.Equals(this.pesNmPessoa, cast.PesNmPessoa) == false)
            return false;
      
         if (String.Equals(this.pesNuCpfCnpj, cast.PesNuCpfCnpj) == false)
            return false;
      
         if (this.pesDtCadastro != cast.PesDtCadastro)
            return false;
      
         return true;
      }
   
      /// <summary>
      /// Get object in string format
      /// </summary>
      /// <pdGenerated>Get object in string format</pdGenerated>
      public override string ToString()
      {
         StringBuilder ret = new StringBuilder();
         ret.Append( "Pessoa: " );
         ret.Append( "PesIdPessoa='" + pesIdPessoa.ToString() + "'");
         if (pesNmPessoa != null)
            ret.Append( "PesNmPessoa='" + pesNmPessoa.ToString() + "'");
         if (pesNuCpfCnpj != null)
            ret.Append( "PesNuCpfCnpj='" + pesNuCpfCnpj.ToString() + "'");
         ret.Append( "PesDtCadastro='" + pesDtCadastro.ToString() + "'");
         return ret.ToString();
      }
   
   }
}